<?php
class item_type extends Model{
	public static function getTableName(){
		return 'item_type';
	}

	public static function getItemIDByName($name)
	{
        switch ($name) 
        {
        case 'p_programme':
            $name = 'programme';
            break;
        case 'p_episode':
            $name = 'episode';
            break;
        case 'p_cast':
            $name = 'cast';
            break;
        case 'p_chapter':
            $name = 'chapter';
            break;
        case 'p_image':
            $name = 'image';
            break;
        case 'p_video':
            $name = 'video';
            break;
        case 'p_info_address':
            $name = 'info_address';
            break;
        case 'p_info_award':
            $name = 'info_award';
            break;
        case 'p_info_biography':
            $name = 'info_biography';
            break;
        case 'p_info_general_information':
            $name = 'info_general_information';
            break;
        case 'p_info_pageant':
            $name = 'info_pageant';
            break;
        case 'p_info_product':
            $name = 'info_product';
            break;
        case 'p_info_q_a':
            $name = 'info_q_a';
            break;
        case 'p_info_recipe':
            $name = 'info_recipe';
            break;
        case 'p_info_song':
            $name = 'info_song';
            break;
        }
		$sql = 'select id from item_type where system_label = :name';
		$ret = Model::selectBySql($sql,array(':name'=>$name));
		return isset($ret[0]) ? $ret[0]['id'] : "";
	}
}
?>
